﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace FormsPractice
{
    public class Forms
    {
        public static string Encrypt(string Password)
        {
            return Convert.ToBase64String(Encoding.UTF8.GetBytes(Password));
        }

        public static string Decrypt(string EncryptedPassword)
        {
            byte[] todecode_byte = Convert.FromBase64String(EncryptedPassword);
            UTF8Encoding utf8Decode = new UTF8Encoding();
            int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
            char[] decoded_char = new char[charCount];
            utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
            string decrypted = new string(decoded_char);
            return decrypted;
        }
    }
}